<%@page import="weaver.general.Util"%>
<%@page import="weaver.conn.RecordSet"%>
<%@page import="weaver.file.FileUpload"%>
<%@page import="com.alibaba.fastjson.JSON"%>
<%@page import="java.util.List"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
FileUpload fu = new FileUpload(request);
Map<String,Map<String,String>> map = new HashMap<String, Map<String,String>>();
String workFlowId = Util.null2String(fu.getParameter("workFlowId"),"-1");

String sql = "SELECT B.ID,B.FIELDNAME,E.LABELNAME,B.DETAILTABLE,C.ORDERID FROM WORKFLOW_BASE A LEFT JOIN WORKFLOW_BILLFIELD B ON B.BILLID = A.FORMID LEFT JOIN WORKFLOW_BILLDETAILTABLE C ON C.TABLENAME = B.DETAILTABLE LEFT JOIN HTMLLABELINFO E ON E.INDEXID = B.FIELDLABEL AND E.LANGUAGEID = 7 WHERE A.ID = "+workFlowId+" ORDER BY B.ID,B.DSPORDER,B.DETAILTABLE";
RecordSet rs = new RecordSet();
rs.executeSql(sql);
while(rs.next()){
	String orderId = Util.null2String(rs.getString("ORDERID"),"0");
	String key = "tb"+orderId;
	String fieldName = Util.null2String(rs.getString("FIELDNAME"));
	String fieldId = "field"+Util.null2String(rs.getString("ID"));
	String labelName = Util.null2String(rs.getString("LABELNAME"));
	Map<String,String> fieldMap = map.containsKey(key) ? map.get(key) : new HashMap<String, String>();
	fieldMap.put(fieldName, fieldId);
	map.put(key, fieldMap);
}
out.print(JSON.toJSONString(map));
%>
